/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;

public class UIUtils {

    static JPanel createJPanelWithTitle(String title, LayoutManager layout) {
        JPanel titlePanel = new JPanel(layout);
        Border borderTitle = BorderFactory.createTitledBorder(new LineBorder(Color.GRAY), title);
        Border borderSpace = BorderFactory.createEmptyBorder(5, 5, 5, 5);
        titlePanel.setBorder(BorderFactory.createCompoundBorder(borderTitle, borderSpace));

        return titlePanel;
    }

    static JPanel createJPanelWithTitle(String title) {
        JPanel titlePanel = createJPanelWithTitle(title, new FlowLayout());
        return titlePanel;
    }

    static Border createBorderTitle(String title) {
        Border borderTitle = BorderFactory.createTitledBorder(new LineBorder(Color.GRAY), title);
        Border borderSpace = BorderFactory.createEmptyBorder(5, 5, 5, 5);

        return BorderFactory.createCompoundBorder(borderTitle, borderSpace);
    }
}
